@extends('layouts.adminlayout')

@section('main')

<section class="content">
    <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
        <div class="box box-primary">
            <div class="box-header">
                <h3 class="box-title">Tạo Bài Viết <small>Thông tin, tin tức, sự kiện, thông báo</small></h3>
            </div><!-- /.box-header -->
            {{ Form::open(array('route' => 'news.store','role'=>'form')) }}
            <div class="box-body">
                <div class="form-group">
                    {{ Form::label('ChuyenMucBaiViet_Id', 'Chuyên Mục Bài Viết') }}
                    <select name="ChuyenMucBaiViet_Id" class="form-control" required>
                        <option value=''>Chọn</option>
                        @foreach ($chuyen_muc as $chuyen_muc) 
                        <option value='{{{$chuyen_muc->id}}}'>{{{$chuyen_muc->ten_chuyen_muc}}}</option>
                        @endforeach
                    </select>
                </div>
                <div class="form-group">
                    {{ Form::label('tieu_de', 'Tiêu Đề') }}
                    {{ Form::text('tieu_de',null,array('required','class'=>'form-control')) }}
                </div>
                <div class="form-group">
                    {{ Form::label('tom_tat', 'Tóm Tắt') }}
                    {{ Form::textarea('tom_tat',null,array('style'=>'width:100%','class'=>'form-control')) }}
                </div>
                <div class="form-group">
                    {{ Form::label('noi_dung', 'Nội Dung') }}
                    {{ Form::textarea('noi_dung',null,array('style'=>'width:100%','class'=>'form-control')) }}
                </div>
                <div class="form-group">
                    {{ Form::label('tag', 'Tag') }}
                    {{ Form::text('tag',null,array('class'=>'form-control')) }}
                </div>
            </div>
            <div class="box-footer">
                {{ Form::submit('Lưu Bài Viết', array('class' => 'btn btn-info')) }}
                {{ link_to_route('news.index', 'Huỷ', null, array('class' => 'btn')) }}
 

            </div>
            {{ Form::close() }}

            <br>
                @if ($errors->any())
                    {{ implode('', $errors->all('<div class="error callout callout-danger">:message</div>')) }}
                @endif
        </div>
    </div>


    <!-- CKEditor -->
    <script src="<?php echo asset('public/plugins/ckeditor/ckeditor.js'); ?>" type="text/javascript"></script>
    <script src="<?php echo asset('public/plugins/ckeditor/adapters/jquery.js'); ?>" type="text/javascript"></script>
    <!-- CKFinder -->
    <script src="<?php echo asset('public/plugins/ckfinder/ckfinder.js'); ?>" type="text/javascript"></script>
    <script type="text/javascript">
        $( document ).ready( function() {
            var noi_dung = CKEDITOR.replace( 'noi_dung', {
                filebrowserBrowseUrl : '<?php echo asset("public/plugins/ckfinder/ckfinder.html"); ?>',
                filebrowserImageBrowseUrl : '<?php echo asset("public/plugins/ckfinder/ckfinder.html?type=Images"); ?>',
                filebrowserFlashBrowseUrl : '<?php echo asset("public/plugins/ckfinder/ckfinder.html?type=Flash"); ?>',
                filebrowserUploadUrl : '<?php echo asset("public/plugins/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files"); ?>',
                filebrowserImageUploadUrl : '<?php echo asset("public/plugins/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images"); ?>',
                filebrowserFlashUploadUrl : '<?php echo asset("public/plugins/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash"); ?>'
            });
            CKFinder.setupCKEditor( noi_dung, '<?php echo asset("public/plugins"); ?>');

            var tom_tat = CKEDITOR.replace( 'tom_tat', {
                filebrowserBrowseUrl : '<?php echo asset("public/plugins/ckfinder/ckfinder.html"); ?>',
                filebrowserImageBrowseUrl : '<?php echo asset("public/plugins/ckfinder/ckfinder.html?type=Images"); ?>',
                filebrowserFlashBrowseUrl : '<?php echo asset("public/plugins/ckfinder/ckfinder.html?type=Flash"); ?>',
                filebrowserUploadUrl : '<?php echo asset("public/plugins/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files"); ?>',
                filebrowserImageUploadUrl : '<?php echo asset("public/plugins/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images"); ?>',
                filebrowserFlashUploadUrl : '<?php echo asset("public/plugins/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash"); ?>'
            });
            CKFinder.setupCKEditor( tom_tat, '<?php echo asset("public/plugins"); ?>');
        } );
    </script>

</section>
@stop


